//增加过滤功能
let baseUrl = 'http://www.itcbc.com:8080'
$.ajaxPrefilter(function (option) {
    //1.设置统一根路径接口
    option.url = baseUrl + option.url
    //2.统一配置请求头
    option.headers = {
        Authorization: localStorage.getItem('token')

    }
    //3.阻止非法进入
    //不论结果成功或者失败都是有返回值得
    option.complete=function (xhr) {
      
        let res = xhr.responseJSON
        if (res && res.status === 1 && res.message === '身份认证失败') {
            localStorage.removeItem('token')
            location.href='./login.html'
        }
    }
})

